# -*- coding: utf-8 -*-
# @Time : 2024/2/18 14:30
# @Author : ZH
# @File : 121.py
# @Software: PyCharm
from typing import List

class Solution:
    def maxProfit(self, prices: List[int]) -> int:
        max_profit = 0
        min_price = prices[0]
        for price in prices[1:]:
            max_profit = max(price-min_price, max_profit)
            min_price = min(price, min_price)
        return max_profit



if __name__ == '__main__':
    so = Solution()
    so.maxProfit(prices=[7,1,5,3,6,4])


